*figure 5

cd "/Users/kevin/Dropbox/TZ ITNs"
set more off
set varabbrev off

use "constructed data/for_analysis.dta", clear

cd "/Users/kevin/Dropbox/TZ ITNs/plots"

forvalues i=30(15)90 {
reg approve_vc1 post  if period_`i'==1 & omitperiod==0, r cluster(dist_id)
estimates store period_`i'
}

coefplot (period_30, label("30 days")) (period_45, label("45 days")) (period_60, label("60 days")) ///
(period_75, label("75 days")) (period_90, label("90 days")), keep(post) rename(post="treatment effect") ///
vertical graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))  ciopts(lcolor(black)) mcolor(black) ///
title("VC approval") ylabel(-0.2(0.2)0.8) yscale(r(-0.2, 0.8)) ///
xlabel( .668 "30" .834 "45" 1 "60" 1.166 "75" 1.332 "90") legend(off) xtitle("Number of days", size(medlarge))
graph save Graph "binary_vc_fade_bw.gph", replace

forvalues i=30(15)90 {
reg approve_veo1 post if period_`i'==1 & omitperiod==0, r cluster(dist_id)
estimates store period_`i'
}

coefplot (period_30, label("30 days")) (period_45, label("45 days")) (period_60, label("60 days")) ///
(period_75, label("75 days")) (period_90, label("90 days")), keep(post) rename(post="treatment effect") ///
vertical graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))  ciopts(lcolor(black)) mcolor(black) ///
title("VEO approval") ylabel(-0.2(0.2)0.8) yscale(r(-0.2, 0.8)) ///
xlabel( .668 "30" .834 "45" 1 "60" 1.166 "75" 1.332 "90") legend(off) xtitle("Number of days", size(medlarge))
graph save Graph "binary_veo_fade_bw.gph", replace

forvalues i=30(15)90 {
reg approve_councillor1 post if period_`i'==1 & omitperiod==0, r cluster(dist_id)
estimates store period_`i'
}

coefplot (period_30, label("30 days")) (period_45, label("45 days")) (period_60, label("60 days")) ///
(period_75, label("75 days")) (period_90, label("90 days")), keep(post) rename(post="treatment effect") ///
vertical graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))  ciopts(lcolor(black)) mcolor(black) ///
title("Councillor approval") ylabel(-0.2(0.2)0.8) yscale(r(-0.2, 0.8)) ///
xlabel( .668 "30" .834 "45" 1 "60" 1.166 "75" 1.332 "90") legend(off) xtitle("Number of days", size(medlarge))
graph save Graph "binary_councillor_fade_bw.gph", replace

forvalues i=30(15)90 {
reg approve_weo1 post if period_`i'==1 & omitperiod==0, r cluster(dist_id)
estimates store period_`i'
}

coefplot (period_30, label("30 days")) (period_45, label("45 days")) (period_60, label("60 days")) ///
(period_75, label("75 days")) (period_90, label("90 days")), keep(post) rename(post="treatment effect") ///
vertical graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))  ciopts(lcolor(black)) mcolor(black) ///
title("WEO approval") ylabel(-0.2(0.2)0.8) yscale(r(-0.2, 0.8)) ///
xlabel( .668 "30" .834 "45" 1 "60" 1.166 "75" 1.332 "90") legend(off) xtitle("Number of days", size(medlarge))
graph save Graph "binary_weo_fade_bw.gph", replace

forvalues i=30(15)90 {
reg approve_mp1 post if period_`i'==1 & omitperiod==0, r cluster(dist_id)
estimates store period_`i'
}

coefplot (period_30, label("30 days")) (period_45, label("45 days")) (period_60, label("60 days")) ///
(period_75, label("75 days")) (period_90, label("90 days")), keep(post) rename(post="treatment effect") ///
vertical graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))  ciopts(lcolor(black)) mcolor(black) ///
title("MP approval") ylabel(-0.2(0.2)0.8) yscale(r(-0.2, 0.8)) ///
xlabel( .668 "30" .834 "45" 1 "60" 1.166 "75" 1.332 "90") legend(off) xtitle("Number of days", size(medlarge))
graph save Graph "binary_mp_fade_bw.gph", replace

graph combine "binary_vc_fade_bw.gph" "binary_veo_fade_bw.gph" "binary_councillor_fade_bw.gph" "binary_weo_fade_bw.gph" ///
"binary_mp_fade_bw.gph", ///
  rows(2) cols(3) subtitle(, color(black) fcolor(white) lcolor(white)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white)) 
